
import requests
import unittest


class TestLogin(unittest.TestCase):

    def test_login(self):

        # 构造数据
        json_data = {
            "username":"admin",
            "password":"admin123"
        }

        # 查找登录接口
        url = 'http://127.0.0.1:9099/login'
        response = requests.post(url=url,json=json_data).json()
        current_msg = response.get('errMsg','not found')

        # 断言
        self.assertEqual(current_msg,'success')


if __name__ == '__main__':
    unittest.main()